<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="admin/_fragments :: head(~{::title})">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <title>标签管理</title>
    <!--    <link rel="stylesheet" href="css/semantic.min.css">-->
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
    <link rel="stylesheet" href="../../static/css/me.css">
</head>
<body>
<!--导航-->
<nav th:replace="admin/_fragments :: menu(3)" class="ui inverted attached segment m-padded-tb-mini m-shadown-small">
    <div class="ui container">
        <div class="ui inverted secondary stackable menu">
            <h2 class="ui header teal item">后台管理</h2>
            <a href="#" class="m-item item m-mobile-hide"><i class="home icon"></i>首页</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="idea icon"></i>分类</a>
            <a href="#" class="m-item item m-mobile-hide"><i class="tags icon"></i>标签</a>
            <div class="right m-item m-mobile-hide menu">
                <div class="ui dropdown item">
                    <div class="text">
                        <img src="../../static/images/touxiang.jpg" th:src="@{/images/touxiang.jpg}" alt="" class="ui avatar image">
                        周纯彬
                    </div>
                    <i class="dropdown icon"></i>
                    <div class="menu">
                        <a href="#" th:href="@{/admin/logout}" class="item">注销</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <a href="#" class="ui menu toggle black icon button m-right-top m-mobile-show ">
        <i class="sidebar icon"></i>
    </a>
</nav>
<!--二级导航-->
<div class="ui attached pointing menu">
    <div class="ui container">
        <div class="right menu">
            <a href="release.html" th:href="@{/admin/tags/tags_release}" class="item">发布</a>
            <a href="blogs.html" th:href="@{/admin/tags}" class="teal active item">列表</a>
        </div>
    </div>
</div>
<!--=========================中间内容==============================-->

<div class="m-padded-tb-larges m-container-small">
    <div class="ui container">
        <div class="ui success message" th:unless="${#strings.isEmpty(TagMessage)}">
            <i class="close icon"></i>
            <h2 class="header">提示：</h2>
            <p th:text="${TagMessage}" >恭喜，操作成功</p>
        </div>
        <div class="ui error message" th:unless="${#strings.isEmpty(FailTagMessage)}">
            <i class="close icon"></i>
            <h2 class="header">提示：</h2>
            <p th:text="${FailTagMessage}" >恭喜，操作成功</p>
        </div>
        <table class="ui table celled center aligned">
            <thead>
            <tr>
                <th>/</th>
                <th>名称</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            <tr th:each="tag,iterStat : ${tagPageInfo.list}">

                <td id="typeId" style="display: none!important;" th:text="${tag.id}"></td>
                <td th:text="${iterStat.count}">1</td>
                <td th:text="${tag.name}">可以练习清单</td>
                <td>
                    <a href="#"  th:href="@{/admin/tags/{id}/input(id=${tag.id})}" class="ui font-blue mini button"><span style="color: white">编辑</span></a>
                    <a href="#"  class="ui remove red mini button">删除</a>
                </td><!--th:href="@{/admin/types/{id}/delete(id=${type.id})}"-->
            </tr>
            </tbody>
            <tfoot>
            <tr>
                <th colspan="6">
                    <div class="ui pagination mini menu">
                        <a href="#" th:href="@{/admin/tags(pn=${tagPageInfo.pageNum}-1)}" th:classappend="${tagPageInfo.isFirstPage}?'disabled'" class="item ">上一页</a>
                        <a href="#" th:href="@{/admin/tags(pn=${tagPageInfo.pageNum}+1)}" th:classappend="${tagPageInfo.isLastPage}?'disabled'" class="item">下一页</a>

                    </div>
                    <a href="#" th:href="@{/admin/tags/tags_release}" class="ui mini right floated teal basic button">新增</a>
                </th>
            </tr>
            </tfoot>
        </table>

    </div>
</div>
<br>
<br>
<br>
<div class="ui mini modal">
    <div class="header">确认删除吗</div>
    <div class="content" style="text-align: center !important;">
        <span>确认删除- </span>
        <span id="typeName" style="color: teal!important;">就是玩 </span>
        <span id="type-id" style="display: none !important;"> 就是玩</span>
        <span> -吗？</span>
    </div>
    <div class="actions">
        <div class="ui olive basic cancel  button">
            <i class="remove icon"></i>取消</div>
        <div class="ui red ok inverted button" >
            <i class="checkmark icon"></i><a class="ui fluid" id="delType" style="color: red">确认</a> </div>
    </div>
</div>
<br>
<br>
<br>
<br>
<!--========================底部footer===============================-->
<!---->
<footer class="ui inverted vertical segment m-padded-tb-big" th:replace="admin/_fragments :: footer">
    <div class="ui center aligned container">
        <div class="ui stackable inverted divided grid">
            <div class="three wide column">
                <div class="ui inverted link list">
                    <div class="item">
                        <img src="../../static/images/meWechat.jpg" th:src="@{/images/meWechat.jpg}" class="ui rounded image" alt="" style="width: 110px">
                    </div>
                </div>
            </div>
            <div class="four wide column">
                <h4 class="ui inverted header  m-font-spaced" style="font-weight: normal">最新博客</h4>
                <div class="ui inverted link list m-font-thin">
                    <a href="#" class="item">笔记01</a>
                    <a href="#" class="item">笔记01</a>
                    <a href="#" class="item">笔记01</a>
                </div>
            </div>

            <div class="five wide column">
                <h4 class="ui inverted header" style="font-weight: normal">Blog介绍</h4>
                <p class="m-font-thin m-font-spaced m-opacity-mini ">修炼一途，乃窃阴阳，夺造化，转涅槃，握生死，掌轮回。 武之极，破苍穹，动乾坤！</p>
            </div>
            <div class="four wide column">
                <h4 class="ui inverted header  m-font-spaced" style="font-weight: normal">联系我</h4>
                <div class="ui inverted  list" style="text-align: left;margin-left: 30px">
                    <div class="item">
                        <img src="../../static/images/qq.png" th:src="@{/images/qq.png}" style="width: 20px">
                        <span class="m-font-thin m-opacity-mini"
                              style="font-size: 14px">&nbsp;&nbsp;QQ：2251073096</span>
                    </div>
                    <div class="item">
                        <img src="../../static/images/email.png" th:src="@{/images/email.png}" style="width: 18px">
                        <span class="m-opacity-mini" style="font-size: 14px">&nbsp;&nbsp;Eamil：2251073096@qq.com</span>
                    </div>
                </div>
            </div>
        </div>

        <div class="ui inverted section divider"></div>
        <p class="m-font-thin m-font-spaced m-opacity-tiny" style="font-size: 13px">Copyright © 2021 - 2022 ZhouChB All
            Rights Reserved V.1.0</p>
    </div>
</footer>
<!--<script src="https://cdn.jsdelivr.net/npm/jquery@3.2/dist/jquery.min.js"/>-->
<script src="../../static/js/jquery.min.js" th:src="@{/js/jquery.min.js}"></script>
<script src="../../static/js/semantic.min.js" th:src="@{/js/semantic.min.js}"></script>
<script>
    /*关闭消息提示*/
    $('.message .close').on('click',function () {
        $(this)
        .closest('.message')
        .transition('fade');
    });
/*获取id*/
$('.remove').on('click',function () {
    var type_name = $(this).parents("td").parents("tr").find("td:eq(2)").text();
    document.getElementById("typeName").innerHTML=type_name;
    var type_id = $(this).parents("td").parents("tr").find("td:eq(0)").text();
    document.getElementById("type-id").innerHTML=type_id;
    $('.ui.mini.modal').modal('show');


})
/*    删除*/
 $('#delType').on('click',function () {
   //  var type_id = $(this).parents("td").parents("tr").find("td:eq(0)").text();
    var id = document.getElementById("type-id").textContent;

     $.ajax({
         url: "/admin/tag/del/"+id,
         type: "GET",
         success:function (result) {
            window.location.reload();
             console.log(result)
         }
     })
 })



    /*页眉三杠*/
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    })
</script>
<!--<script>
    $('.menu.toggle').click(function () {
        $('.m-item').toggleClass('m-mobile-hide');
    });
</script>-->
<script src="../../static/js/my.js" th:src="@{/js/my.js}"></script>
<!--<script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.js"></script>-->

</body>
</html>